﻿using AutoMapper;
using EFEntity;
using ISerives;
using Model;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Serives
{
    public class config_file_second_kindServices : Iconfig_file_second_kindServices
    {
        private readonly MyDbContext myDbContext;
        private readonly IMapper mapper;
        public config_file_second_kindServices(MyDbContext myDbContext, IMapper mapper)
        {
            this.myDbContext = myDbContext;
            this.mapper = mapper;
        }
        public async Task<List<config_file_second_kind>> Select()
        {
            List<config_file_second_kind> list1 = new List<config_file_second_kind>();
            await Task.Run(() =>
            {
                List<Econfig_file_second_kind> list = myDbContext.config_file_second_kind.ToList();
                list1 = mapper.Map<List<config_file_second_kind>>(list);

            });
            return list1;
        }
        public async Task<List<config_file_second_kind>> Selectlist(string id)
        {
            List<config_file_second_kind> list = new List<config_file_second_kind>();
            await Task.Run(() =>
            {
                List<Econfig_file_second_kind> Elist = myDbContext.config_file_second_kind.Where(e => e.first_kind_id == id).ToList();
                list = mapper.Map<List<config_file_second_kind>>(Elist);
            });
            return list;
        }
    }
}
